// pages/tongxun_l/tongxun_l.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
     
  },
  radioChange(e) {
    console.log('radio1发生change事件，携带value值为：', e.detail.value)
    const items = this.data.items;
    var ui_d = e.currentTarget.dataset.id; 
    wx.request({
      url: app.globalData.url_l + 'api/order/tian_qianshu',
      method: 'post',
      data:{
          uid:ui_d,
          type:app.globalData.type_id,
          id:app.globalData.qs_id1 
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        console.log(res)
        if(res.data.state==1){
          app.globalData.tx = res.data.xinxi
          console.log(app.globalData.tx)
          wx.navigateBack()
        }else{
          
        }
      }
    })
    
  },
  radioChange1(e) {
    console.log('radio发生change事件，携带value值为：', e.detail.value)
    // wx.navigateBack()
    const items = this.data.items
    var ui_d = e.currentTarget.dataset.id; 
    console.log(ui_d)
    console.log(app.globalData.type_id)
    console.log(app.globalData.qs_id1 )
    wx.request({
      url: app.globalData.url_l + 'api/order/tian_qianshu',
      method: 'post',
      data:{
          uid:ui_d,
          type:app.globalData.type_id,
          id:app.globalData.qs_id1 
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        console.log(res)
        if(res.data.state==1){
          app.globalData.tx = res.data.xinxi
          console.log(app.globalData.tx)
          wx.navigateBack()
        }else{
          
        }
      }
    })
  },
  qs_i:function(e){
    app.globalData.sou = e.detail.value
  },
  /**
   * 生命周期函数--监听页面加载
   */
  tianjia:function(e){
    wx.navigateTo({
      url: '../tianjia_kh/tianjia_kh',
    })
  },
  gr_xx:function(e){
    var ui_d = e.currentTarget.dataset.id; 
    var shen_f = e.currentTarget.dataset.shen_f; 
    console.log(ui_d)
    wx.navigateTo({
      url: '../gr_xx1/gr_xx1?ui_d='+ui_d+"&shen_f="+shen_f,
    })
  },
  onLoad: function (options) {
    var that = this;
    app.globalData.tx = ''
    var chuan_s = options.chuan_s;
    var type_id = options.type_id;
    app.globalData.type_id = type_id
    console.log(app.globalData.type_id)
    var qianshu_id = options.qianshu_id;
    var qs_id1 = options.qs_id1;
    app.globalData.qs_id1 = qs_id1
    if(qianshu_id==0){
      that.setData({
        qianshu_id1:"display:inline-block",
        qianshu_id2:"display:none"
      })
    }else if(qianshu_id==1){
      that.setData({
        qianshu_id2:"display:inline-block",
        qianshu_id1:"display:none"
      })
    }else if(qianshu_id==2){
      that.setData({
        qianshu_id2:"display:inline-block",
        qianshu_id1:"display:inline-block"
      })
    }
    
   
    if(chuan_s==1){
        that.setData({
          xz_l:"width:10%;display:none",
          xz_l1:"width:88%;display:inline-block;margin-left:0%",
        })
    }else if(chuan_s==0){
      that.setData({
        xz_l:"width:10%;display:inline-block",
        xz_l1:"width:88%;display:inline-block;margin-left:2%",
      })
  }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    wx.request({
      url: app.globalData.url_l + 'api/member/lianxi_list',
      method: 'post',
      data:{
          uid:app.globalData.uid,
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        console.log(res)
         that.setData({
          qiye:res.data.qiye,
          lianxi:res.data.lianxi,
          mem:res.data.mem,
         })
      }
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})